package edu.gdin.ecommerce.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.opensymphony.xwork2.ActionSupport;

import edu.gdin.ecommerce.model.OperLog;
import edu.gdin.ecommerce.service.IOperLogService;
import edu.gdin.ecommerce.util.Pager;

@Component("operLogAction")
@Scope("prototype")
public class OperLogAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3809305077550607506L;
	
	private IOperLogService operLogService;
	private OperLog operLog;
	private Pager pager;
	
	private String operTime1;
	private String operTime2;
	private Integer currentPage = 1;
	

	public IOperLogService getOperLogService() {
		return operLogService;
	}
	@Resource
	public void setOperLogService(IOperLogService operLogService) {
		this.operLogService = operLogService;
	}
	public OperLog getOperLog() {
		return operLog;
	}
	public void setOperLog(OperLog operLog) {
		this.operLog = operLog;
	}
	public Pager getPager() {
		return pager;
	}
	public void setPager(Pager pager) {
		this.pager = pager;
	}
	public String getOperTime1() {
		return operTime1;
	}
	public void setOperTime1(String operTime1) {
		this.operTime1 = operTime1;
	}
	public String getOperTime2() {
		return operTime2;
	}
	public void setOperTime2(String operTime2) {
		this.operTime2 = operTime2;
	}
	public Integer getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}
	
	// ----------  methods  -----------
	
	public String queryLog() {
		this.pager = this.operLogService.queryLog(this.operLog, this.operTime1, this.operTime2, this.currentPage);
		if(this.pager.getList().size() == 0) {
			this.addFieldError("msg", "没找到符合条件的操作日志！");
		}
		return "queryLog";
	}
	
	

}
